package com.zhangdi.dwtools.text;

import org.apache.commons.lang3.RandomStringUtils;

import java.util.*;

public class StringUtils extends org.apache.commons.lang3.StringUtils {
    /**
     * 空字符串
     */
    private static final String NULLSTR = "";

    /**
     * 下划线
     */
    private static final char SEPARATOR = '_';
    private static final String chars = "0123456789abcdefghijklmnopqrstuvwxyz";

    public static boolean isNullOrEmpty(String str) {
        if (null == str || str.length() == 0) {
            return true;
        }

        return str.trim().length() == 0;
    }

    public static String randomStr(int count) {
        return "用户" + RandomStringUtils.random(count, chars);
    }

    public static void main(String[] args) {
//        List<String> repeatList = new ArrayList<>();
//        Map<String, Integer> map = new HashMap<>();
//        for (int i = 0; i < 1000000; i++) {
//            String r = StringUtils.uuid(11);
//            if (!map.containsKey(r)) {
//                map.put(r, i);
//            } else {
//                repeatList.add(r);
//            }
//        }
//        System.out.println(map.size());
//        System.out.println(repeatList.size());
        System.out.println(randomStr(8));
    }
}